package com.cracker.websocket.server.service;

import com.cracker.websocket.server.service.impl.MessageHandlerImplChat;
import com.cracker.websocket.server.service.impl.MessageHandlerImplChatRoom;
import com.cracker.websocket.server.service.impl.MessageHandlerImplGroup;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FactoryService {
    @Autowired
    private MessageHandlerImplChat chat;
    @Autowired
    private MessageHandlerImplGroup group;
    @Autowired
    private MessageHandlerImplChatRoom chatRoom;

    public MessageHandler getHandler(String type) {
        switch (type) {
            default:
                return null;
            case "chat":
                return chat;
            case "chatRoom":
                return chatRoom;
            case "group":
                return group;
        }
    }
}
